<script src="/media/js/catalog/catalog_admin.js"></script>
<script type="text/javascript" src="/media/js/validate.js"></script>
<link href="/media/js/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/media/js/uploadify/swfobject.js"></script>
<script type="text/javascript" src="/media/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript" src="/media/js/color/iColorPicker.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        
         $("#form").validate({
            rules:{
                name:'required',
                meta_url:'url',
                position:'number'
            },
            messages:{
                name:'分类名称不能为空！',
                meta_url:'链接格式不对,请重新添加!格式如：http://www.xuwentec.com',
                position:'请添写正确的数字格式！'
            },
            invalidHandler: function(e, validator) {
                var errors = validator.numberOfInvalids();
                if (errors) {
                    var message = errors == 1
                        ? '您有<font color="green">1</font>处填写错误,请认真填写！'
                    : '您有 <font color="green">' + errors + ' </font>处填写错误,请认真填写！';
                    $("div.error #error-info").html(message);
                    $('div.success').hide();
                    $("div.error").show();
                } else {
                    $("div.error").hide();
                }
            }
        });
        
        
        
        
        
        
        $('#custom_file_upload').uploadify({
            'uploader'       : '/media/js/uploadify/uploadify.swf',
            'script'         : '<?php echo URL::base()."admin/uploadify/images"; ?>',
            'cancelImg'      : '/media/js/uploadify/cancel.png',
            'folder'         : '/uploads/newscate',
            'multi'          : true,
            'auto'           : true,
            'fileExt'        : '*.jpg;*.gif;*.png',
            'fileDesc'       : 'Image Files (.JPG, .GIF, .PNG)',
            'queueID'        : 'custom-queue',
            'queueSizeLimit' : 300,
            'simUploadLimit' : 2,
            'removeCompleted': false,
            'displayData'   : 'shown',
            'scriptData': {"PHPSESSID":"<?php echo session_id(); ?>"},
            'onSelectOnce'   : function(event,data) {
                $('#status-message').text(data.filesSelected + ' files have been added to the queue.');
            },
            'onAllComplete'  : function(event,data) {
                $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
            }
        });	
    });
</script>
<div id="page-layout"><div id="page-content">
        <div id="page-content-wrapper" >
            <div class="hastable">
                <div class="inner-page-title">
                    <h2>分类管理</h2>
                </div>
                <?php echo Message::get();?>
            <div class="response-msg error ui-corner-all" style="display:none;">
                <span>错误提示</span><span id="error-info"></span>
            </div>
                <div class="two-column">
                    <div class="column" style="width: 20%">

                        <ul class="catalog_tree_width portlet ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
                            <li><div class="portlet-header ui-widget-header">新闻分类 <a id="catalog_tree_collapse_expand" href="#" >收起所有</div></a>
                                <?php echo $catalog_tree; ?>
                            </li>
                        </ul>
                    </div>
                    <div style="width: 78%;float: right;">

                        <div class="portlet ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
                            <div class="portlet-header ui-widget-header">编辑内容<span class="ui-icon ui-icon-circle-arrow-s"></span></div>
                           
                            <div class="portlet-content">

                                <form action="<?php echo URL::base().'admin/newscategory/add';?>" method="post" enctype="multipart/form-data" class="forms" name="form" id="form">
                                        <ul>
                                            <li>
                                                <label  class="desc"> 分类名称： <span class="req">*</span></label>
                                                <div>
                                                    <input type="text" id="title" tabindex="1" maxlength="255" value="" class="field text medium" name="name" />
                                                    标题颜色：<input id="color" name="color" type="text" value="" class="iColorPicker" />
                                                    &nbsp;&nbsp;是否加粗：<select name="strong"><option value="0">否</option><option value="1">是</option></select>
                                                </div>
                                            </li>


                                            <li>
                                                <font style="font-weight: bold;color:#222222">上级分类：</font>
                                                <select tabindex="3" class="field select small" name="id_parent" > 
                                                    <option value="0">根目录</option>
                                                    <?php echo $news_categories; ?>
                                                </select>
                                            </li>

                                            <li>
                                                <label  class="desc"> 链接： </label>
                                                <div>
                                                    <input type="text" tabindex="1" maxlength="255" value="" class="field text medium" name="meta_url" />
                                                </div>
                                            </li>
                                            <li>
                                                <font style="font-weight: bold;color:#222222">排序：</font> 
                                                <input type="text" tabindex="1" maxlength="255" value="" class="field text" name="position" />
                                                <font style="font-weight: bold;color:#222222">导航显示：
                                                <select name="is_index"><option value="0">否</option><option value="1">是</option></select>
                                                
                                                </font> 

                                            </li>
                                            
                                            <li>
                                                <label  class="desc">
                                                    简介：
                                                </label>
                                                <div>
                                                    <textarea tabindex="2" cols="50" rows="5" class="field textarea small" name="description" ></textarea>
                                                </div>
                                            </li>
                                            <li>
                                                <label  class="desc"> meta_title： </label>
                                                <div>
                                                    <input type="text" tabindex="1" maxlength="255" value="" class="field text medium" name="meta_title" />
                                                </div>
                                            </li>
                                            <li>
                                                <label  class="desc"> meta_keywords： </label>
                                                <div>
                                                    <input type="text" tabindex="1" maxlength="255" value="" class="field text medium" name="meta_keywords" />
                                                </div>
                                            </li>
                                            <li>
                                                <label  class="desc">
                                                    meta_description：
                                                </label>
                                                <div>
                                                    <textarea tabindex="2" cols="50" rows="5" class="field textarea small" name="meta_description" ></textarea>
                                                </div>
                                            </li>

                                        </ul>
                                    <label class="desc">图片上传：</label>  
                                    <input id="custom_file_upload" type="file" name="Filedata" /> 
                                       <div id="custom-queue"></div>
                                    <ul>
                                        <li class="buttons" style=" text-align: center;">
                                            <button class="ui-state-default ui-corner-all ui-button" type="submit" id="submit_btn">  添加分类</button>
                                        </li>
                                    </ul>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <div class="clear"></div>

            <?php echo View::factory('admin/content/content_left')->render(); ?>

            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="clear"></div>	